GraphLinksModelLinkData
A simple representation of link data that supports property change notification, copying, and undo via the INotifyPropertyChanged, ICloneable, and IChangeDataValue interfaces.
Implements: INotifyPropertyChanged, IChangeDataValue, ICloneable
Constructors
public GraphLinksModelLinkData()
graphLinksModelLinkData = GraphLinksModelLinkData()
The default constructor produces an empty object with no references to nodes.
public GraphLinksModelLinkData(NodeKey from, PortKey fromport, NodeKey to, PortKey toport)
graphLinksModelLinkData = GraphLinksModelLinkData(from, fromport, to, toport)
This constructor initializes the From and To properties.
- from
- a node key identifying the node data from which the link comes
- fromport
- an optional value identifying which port on the "from" node the link is connected to
- to
- a node key identify the node data to which the link goes
- toport
- an optional value identifying which port on the "to" node the link is connected to
public GraphLinksModelLinkData(NodeKey from, NodeKey to)
graphLinksModelLinkData = GraphLinksModelLinkData(from, to)
This constructor initializes the From and To properties.
- from
- to
Properties
public string Category { get; set; }
value = graphLinksModelLinkData.Category
graphLinksModelLinkData.Category = value
Gets or sets a String that names the category to which the link data belongs.
public NodeKey From { get; set; }
value = graphLinksModelLinkData.From
graphLinksModelLinkData.From = value
Gets or sets the key value of the node from which this link comes.
public PortKey FromPort { get; set; }
value = graphLinksModelLinkData.FromPort
graphLinksModelLinkData.FromPort = value
Gets or sets the optional parameter information for the From node's port.
public NodeKey LabelNode { get; set; }
value = graphLinksModelLinkData.LabelNode
graphLinksModelLinkData.LabelNode = value
Gets or sets the key value of the node which is on this link acting as if it were a label.
public IEnumerable<Point> Points { get; set; }
value = graphLinksModelLinkData.Points
graphLinksModelLinkData.Points = value
Gets or sets a collection of Points used to define the path of the link.
public string Text { get; set; }
value = graphLinksModelLinkData.Text
graphLinksModelLinkData.Text = value
Gets or sets a string that can be used for a text label on a link.
public NodeKey To { get; set; }
value = graphLinksModelLinkData.To
graphLinksModelLinkData.To = value
Gets or sets the key value of the node to which this link goes.
public PortKey ToPort { get; set; }
value = graphLinksModelLinkData.ToPort
graphLinksModelLinkData.ToPort = value
Gets or sets the optional parameter information for the To node's port.
Methods
public virtual void ChangeDataValue(ModelChangedEventArgs e, bool undo)
graphLinksModelLinkData.ChangeDataValue(e, undo)
This method implements the IChangeDataValue interface, used to perform state changes for undo and redo.
- e
- an edit describing the change to be performed
- undo
- true if undoing; false if redoing
public virtual object Clone()
result = graphLinksModelLinkData.Clone()
Create a copy of this data; this implements the ICloneable interface.
protected virtual string ConvertNodeKeyToString(NodeKey key)
result = graphLinksModelLinkData.ConvertNodeKeyToString(key)
Convert a key value to a string.
- key
Returns: a String from which String) can recover the original key value
protected virtual string ConvertPortKeyToString(PortKey key)
result = graphLinksModelLinkData.ConvertPortKeyToString(key)
Convert a key value to a string.
- key
Returns: a String from which String) can recover the original key value
protected virtual NodeKey ConvertStringToNodeKey(string s)
result = graphLinksModelLinkData.ConvertStringToNodeKey(s)
Convert a string to a key value.
- s
Returns: a
protected virtual PortKey ConvertStringToPortKey(string s)
result = graphLinksModelLinkData.ConvertStringToPortKey(s)
Convert a string to a key value.
- s
Returns: a
public virtual void LoadFromXElement(XElement e)
graphLinksModelLinkData.LoadFromXElement(e)
Initialize this link data with data held in a Linq for XML XElement.
- e
- the XElement
public virtual XElement MakeXElement(XName n)
result = graphLinksModelLinkData.MakeXElement(n)
Constructs a Linq for XML XElement holding the data of this link.
- n
- the name of the new XElement
Returns: an initialized XElement
public virtual void OnPropertyChanged(ModelChangedEventArgs e)
graphLinksModelLinkData.OnPropertyChanged(e)
Raise the PropertyChanged event.
- e
protected void RaisePropertyChanged(string pname, object oldval, object newval)
graphLinksModelLinkData.RaisePropertyChanged(pname, oldval, newval)
Call this method from property setters to raise the PropertyChanged event.
- pname
- the property name
- oldval
- the value before the property was set
- newval
- the new value
public override string ToString()
result = graphLinksModelLinkData.ToString()
For debugging, use the From and To properties as this object's default text rendering.
Returns: a String like "Node1 --> Node2"
Events
public event PropertyChangedEventHandler PropertyChanged
graphLinksModelLinkData.PropertyChanged += handler
This event implements the INotifyPropertyChanged interface, so that both the model and the dependency object system can be informed of changes to property values.